package com.zsy.petshop_01.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册自定义的拦截器
        registry.addInterceptor(new MyInterceptor())
                // 配置拦截的路径，可以是具体的路径，也可以使用通配符等
                .addPathPatterns("/**")
                // 配置不拦截的路径
                .excludePathPatterns("/login", "/error","/pet");
    }
}
